<template>
  <div class="teacher">
    <div class="title">
      <div class="l">名师推荐</div>
      <!-- <div class="r">查看更多 >>></div> -->
    </div>
    <div class="box">
      <div
        class="item"
        v-for="(item, index) in data"
        :key="index"
        @click="itemCLickHandel(item)"
      >
        <div class="l">
          <img v-if="item?.avatar" :src="QNURL + item?.avatar" alt="" />
          <img v-else src="@/assets/images/avatar.jpg" alt="" />
          <div class="name">{{ item?.nickName }}</div>
        </div>
        <div class="r">
          <span class="r_title">高级讲师</span>
          <span class="pro">妙语连珠</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { QNURL } from "@/config/urlConfig";

// import { useRouter } from "vue-router";

// const router = useRouter();

defineProps({
  data: {
    type: Array as () => any,
    default: () => []
  }
});

function itemCLickHandel(item: any) {
  console.log(item);
  //   router.push({
  //     path: "/live_streaming",
  //     query: {
  //       id: item.id
  //     }
  //   });
}
</script>

<style lang="scss" scoped>
.teacher {
  width: 100%;
  margin-top: 50px;

  .title {
    width: 100%;
    height: 50px;
    // background: linear-gradient(to left, #fff, #e6e5e5);
    border-bottom: 2px solid #dedfe0;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    padding: 0 20px;

    .l,
    .r {
      flex: 1;
      font-size: 20px;
      font-weight: bold;
    }

    .r {
      text-align: right;
      font-size: 14px;
      color: #666;
    }
  }

  .box {
    width: 100%;
    display: flex;
    .item {
      width: 235px;
      height: 120px;
      background-color: #fff;
      border-radius: 10px;
      padding: 15px;
      box-shadow: 1px 1px 1px 1px #dedfe0;
      cursor: pointer;
      margin-right: 10px;
      display: flex;

      &:last-of-type {
        margin-right: 0;
      }

      .l,
      .r {
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: center;
      }

      .l {
        width: 30%;

        img {
          width: 60px;
          height: 60px;
          border-radius: 50%;
        }

        .name {
          font-weight: bold;
          font-size: 16px;
          letter-spacing: 5px;
          margin-left: 5px;
          text-align: center;
        }
      }

      .r {
        width: 70%;
        padding-top: 20px;

        &_title {
          font-size: 18px;
          // font-weight: bold;

          &:hover {
            color: #ff6633;
          }
        }

        .pro {
          color: #aaa9b0;
          font-size: 12px;
        }
      }
    }
  }
}
</style>
